<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Goals</title>
<link rel="stylesheet" type="text/css" href="styles.css">
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
<link rel="home" href="index.html" title="SPADE User's Manual">
<link rel="up" href="spade.bdi.html" title="Chapter 7. BDI Architecture for SPADE Agents">
<link rel="prev" href="spade.bdi.plans.html" title="Plans and Services">
<link rel="next" href="spade.bdi.running.html" title="BDI in action">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<div class="navheader">
<table width="100%" summary="Navigation header">
<tr><th colspan="3" align="center">Goals</th></tr>
<tr>
<td width="20%" align="left">
<a accesskey="p" href="spade.bdi.plans.html">Prev</a> </td>
<th width="60%" align="center">Chapter 7. BDI Architecture for SPADE Agents</th>
<td width="20%" align="right"> <a accesskey="n" href="spade.bdi.running.html">Next</a>
</td>
</tr>
</table>
<hr>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="spade.bdi.goals"></a>Goals</h2></div></div></div>
<p>Goals are instances of the <span class="command"><strong>Goal</strong></span> class. Its constructor receives as a parameter the expression of the Goal.</p>
<pre class="screen">

        g = Goal("Var(O1,1,Int)")
        </pre>
<p>When a goal is added, the BDIAgent will try to perform this goal by invoking services. Once the goal is completed, the goalCompleted callback is called to notify the agent.
        </p>
<pre class="screen">
        $ def goalCompletedCB( goal ):
            print "Goal completed!"
            
        $ agent.saveFact("Value",0)

        $ agent.setGoalCompletedCB( goalCompletedCB )

        $ agent.addGoal( Goal("Var(Value,0,Int)") )
        &gt; "Goal completed!"
        </pre>
</div>
<div class="navfooter">
<hr>
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left">
<a accesskey="p" href="spade.bdi.plans.html">Prev</a> </td>
<td width="20%" align="center"><a accesskey="u" href="spade.bdi.html">Up</a></td>
<td width="40%" align="right"> <a accesskey="n" href="spade.bdi.running.html">Next</a>
</td>
</tr>
<tr>
<td width="40%" align="left" valign="top">Plans and Services </td>
<td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
<td width="40%" align="right" valign="top"> BDI in action</td>
</tr>
</table>
</div>
</body>
</html>
